package com.czm.art_light.controller;

import com.czm.art_light.constant.ApiRouterConsts;
import com.czm.art_light.entity.ArtUserSearchHistory;
import com.czm.art_light.param.response.RestResp;
import com.czm.art_light.service.ArtUserSearchHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 搜索历史信息 API 控制器
 */
@Tag(name = "搜索历史信息管理", description = "搜索历史信息相关接口")
@RestController
@RequestMapping(ApiRouterConsts.HISTORY_SEARCH_API_URL_PREFIX)
public class ArtUserSearchHistoryController {

    @Autowired
    private ArtUserSearchHistoryService artUserSearchHistoryService;

    /**
     * 热门搜索记录前10条
     */
    @Operation(summary = "热门搜索记录前10条")
    @GetMapping("/list")
    public RestResp<List<String>> getHotSearchHistory() {
        // 获取热门搜索记录前10条
        List<String> hotSearchHistory = artUserSearchHistoryService.getHotSearchHistory();
        return RestResp.ok(hotSearchHistory);
    }
}
